//
//  DynamicDetailCell.m
//  TuYouAPP
//
//  Created by L on 14-2-22.
//
//

#import "DynamicDetailCell.h"
#import "DataModel.h"
@implementation DynamicDetailCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}
-(CGFloat)upDateCell:(TYUserState *)apub
{
    float originY = 60.0f;
    CGSize constraint = CGSizeMake(85, CGFLOAT_MAX);
    CGSize size = [apub.mTaguser.mUserDisplayName sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:self.userName.frame.size lineBreakMode:NSLineBreakByWordWrapping];

    CGRect rect;
//    rect = self.userName.frame;
//    rect.size.width = size.width+50;
//    self.userName.frame = rect;
    
    rect = self.sexImage.frame;
    rect.origin.x = size.width +52;
    self.sexImage.frame = rect;

   // self.UserContent.text = @"";
     constraint = CGSizeMake(294, CGFLOAT_MAX);
     size = [apub.mContext sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
     rect = self.UserContent.frame;
    rect.origin.y = 45;
    rect.size.height = size.height+20;
    self.UserContent.frame = rect;
    originY += rect.size.height-30;
    rect = self.botView.frame;
    rect.origin.y = originY+15;
    if (apub.mImgArr  && apub.mImgArr.count >0) {
        
        if (apub.mImgArr.count<=3) {
            rect.size.height = 90;
            originY+= 90;
            self.botView.frame = rect;
        }

        
       else if (apub.mImgArr.count>3&&apub.mImgArr.count<=6) {
            //rect = self.botView.frame;
            rect.size.height = 180;
            originY+= 180;
            self.botView.frame = rect;
        }
        else if (apub.mImgArr.count>6)
        {
           // rect = self.botView.frame;
            rect.size.height = 260;
            originY+= 260;
            self.botView.frame = rect;
        }

    }
    originY += 35;
    rect = self.frame;
    rect.size.height = originY+15;
    self.frame = rect;
    return originY;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
